<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<script type="text/ng-template" id="notebook_folder_renderer.html">
  <div ng-if="node.children == null">
    <a style="text-decoration: none;" href="#/notebook/{{node.id}}">
      <i style="font-size: 10px;" class="icon-doc"/> {{noteName(node)}}
    </a>
  </div>
  <div ng-if="node.children != null">
    <a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)">
      <i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'" /> {{noteName(node)}}
    </a>
    <div ng-if="!node.hidden">
      <ul style="list-style-type: none; padding-left:15px;">
        <li ng-repeat="node in node.children" ng-include="'notebook_folder_renderer.html'" />
      </ul>
    </div>
  </div>
</script>

<div ng-controller="HomeCtrl as home">
  <div ng-show="home.staticHome" class="box width-full home">
    <div class="zeppelin">
      <div class="zeppelin2"></div>
    </div>
    <div style="margin-top: -380px;">
      <h1 class="box-heading" id="welcome">
        Welcome to Zeppelin!
      </h1>
      Zeppelin is web-based notebook that enables interactive data analytics.<br>
      You can make beautiful data-driven, interactive, collaborative document with SQL, code and even more!<br>

      <div class="row">
        <div class="col-md-4" ng-if="ticket">
          <h4>Notebook
            <i ng-class="isReloadingNotes ? 'fa fa-refresh fa-spin' : 'fa fa-refresh'"
              ng-style="!isReloadingNotes && {'cursor': 'pointer'}" style="font-size: 13px;"
              ng-click="reloadNotebookList();"
              tooltip-placement="bottom" tooltip="Reload notes from storage">
            </i>
          </h4>

          <div>
            <h5><a href="" data-toggle="modal" data-target="#noteImportModal" style="text-decoration: none;">
              <i style="font-size: 15px;" class="fa fa-upload"></i> Import note</a></h5>
            <h5><a href="" data-toggle="modal" data-target="#noteNameModal" style="text-decoration: none;">
              <i style="font-size: 15px;" class="icon-notebook"></i> Create new note</a></h5>
            <ul id="notebook-names">
              <li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
              <li ng-repeat="note in home.notes.list | filter:query | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index">
                <i style="font-size: 10px;" class="icon-doc"></i>
                <a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
              </li>
              <div ng-if="!query || query.name === ''">
                <li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index" ng-include="'notebook_folder_renderer.html'" />
              </div>
              <div ng-if="query && query.name !== ''">
                <li ng-repeat="note in home.notes.flatList | filter:query | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index">
                  <i style="font-size: 10px;" class="icon-doc"></i>
                  <a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
                </li>
              </div>
            </ul>
          </div>
        </div>
        <div class="col-md-6">
          <h4>Help</h4>
          Get started with <a style="text-decoration: none;" target="_blank"
                              href="http://zeppelin.apache.org/docs/{{zeppelinVersion}}/index.html">Zeppelin documentation</a><br>

          <h4>Community</h4>
          Please feel free to help us to improve Zeppelin, <br>
          Any contribution are welcome!<br><br>
          <a style="text-decoration: none;" href="http://zeppelin.apache.org/community.html"
             target="_blank"><i style="font-size: 15px;" class="fa fa-users"></i> Mailing list</a><br>
          <a style="text-decoration: none;" href="https://issues.apache.org/jira/browse/ZEPPELIN"
             target="_blank"><i style="font-size: 15px;" class="fa fa-bug"></i> Issues tracking</a><br>
          <a style="text-decoration: none;" href="https://github.com/apache/zeppelin"
             target="_blank"><i style="font-size: 20px;" class="fa fa-github"></i> Github</a>
        </div>
      </div>
    </div>
    <br/><br/><br/>
  </div>


  <!-- Load notebook -->
  <div ng-show="home.notebookHome" id="{{currentParagraph.id}}_paragraphColumn_main"
       ng-repeat="currentParagraph in home.note.paragraphs"
       ng-controller="ParagraphCtrl"
       ng-Init="init(currentParagraph, home.note)"
       ng-class="columnWidthClass(currentParagraph.config.colWidth)"
       class="paragraph-col">
    <div id="{{currentParagraph.id}}_paragraphColumn"
         ng-if="currentParagraph.result"
         ng-include src="'app/notebook/paragraph/paragraph.html'"
         ng-class="{'paragraph-space box paragraph-margin': !asIframe, 'focused': paragraphFocused}"
         ng-hide="currentParagraph.config.tableHide && home.viewOnly">
    </div>
  </div>

  <div style="clear:both;height:10px"></div>
</div>
